﻿@model Telerik.Web.Mvc.GridModel<Nop.Admin.Models.WindAlert.WindDataModel>
@using Telerik.Web.Mvc.UI
@{
    var curTime = (DateTime)ViewBag.CurrentUserDateTime;
    }
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.WindAlert.Data")
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid<Nop.Admin.Models.WindAlert.WindDataModel>()
                    .Name("paymentmethods-grid")
                    .BindTo(Model.Data)
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.StationName)
                        .Template(
                        @<div>
                            @if(item.StationAdjustedTime < curTime.AddHours(-1))
                            {
                                <span style=" color:Red">@item.StationName </span>
                            }
                            else
                            {
                                <span>@item.StationName </span>
                            }
                        </div>
                            )  ;
                        columns.Bound(x => x.StationTime)
                            .Template(
                            @<div>
                            @item.StationTime.ToShortDateString()
                            <br />
                            @item.StationTime.ToShortTimeString()
                            </div>
                            );
                        ;
                        columns.Bound(x => x.StationAdjustedTime)
                            .Template(
                            @<div>
                            @item.StationAdjustedTime.ToShortDateString()
                            <br />
                            @item.StationAdjustedTime.ToShortTimeString()
                            </div>
                            );
                        columns.Bound(x => x.WindSpeed);
                        columns.Bound(x => x.WindGust);
                        columns.Bound(x => x.WindSpeedAgv);
                        columns.Bound(x => x.WindDirection);
                        columns.Bound(x => x.Barometer);
                        columns.Bound(x => x.CloudBase);
                        columns.Bound(x => x.DewPoint);
                        columns.Bound(x => x.Humidity);
                        columns.Bound(x => x.Temperture);
                        
                    })
                    .DataBinding(dataBinding =>
                    {
                        dataBinding.Ajax().Select("RunWindDataTest", "Wind");
                    })
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
